As a technique of this type, heretofore, there have been known painting techniques disclosed in for example Patent Literatures 1 to 4 listed below. In particular, Patent Literature 1 discloses a technique of painting or coating the periphery of a door of a vehicle by use of a robot to which a painting gun, an engaging piece engageable with the door, and a sensor for detecting the position of the door are attached. In this technique, the position of the robot is compensated according to the position of the door detected by the sensor and the engaging piece is engaged with the door. Then, the engaging piece is moved by the robot to open the door, and the robot moves the painting gun to coat the periphery of the door. Herein, after the door is opened, the door position is detected again by the sensor to determine whether the door is in an open state or not. Only when the door is in the open state, painting is carried out.